;; high-order functions

(define map
  (lambda (f args)
    (cond
      ((null? args) '())
      (else 
        (cons
          (f (car args))
          (map f (cdr args)))))))

;; list operations

;; extracting the 1st/2nd/3rd/.. elem in a list

(define first 
  (lambda (p) (car p)))

(define second 
  (lambda (p) (cadr p)))

(define third
  (lambda (p) (caddr p)))